package com.example.test;

import android.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Toast;

import com.example.test.db.DBOpenHelper;

public  class RegisterActivity extends Activity  {
    private Button btnRegister1,back;
    private RadioGroup rg;
    private DBOpenHelper dbOpenHelper;
    private EditText userPhone, userPwd, userEmail, userName,userPwds;
    private String phone, pwd, name, email,rg1;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.register);

        userName = findViewById(R.id.userName);
        userPwd = findViewById(R.id.userPwd);
        userPwds = findViewById(R.id.userPwds);
        btnRegister1 = findViewById(R.id.btnRegister1);
        btnRegister1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                if (userPwds.getText().toString().trim().equals("") || userName.getText().toString().trim().equals("") ||
                        userPwd.getText().toString().trim().equals("")) {
                    Toast.makeText(RegisterActivity.this, "请填写所有内容", Toast.LENGTH_LONG).show();
                    return;
                }
                String message= "账号:" + userName.getText().toString().trim() + "\n密码" + userPwd.getText().toString().trim();
                if (!userPwds.getText().toString().trim().equals(userPwd.getText().toString().trim())) {
                    Toast.makeText(RegisterActivity.this, "密码不一致请remake", Toast.LENGTH_LONG).show();
                    return;
                }
                Toast.makeText(RegisterActivity.this, message, Toast.LENGTH_LONG).show();
            }

        });
        back = findViewById(R.id.back);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}





//    private void init() {
////        userPhone = findViewById(R.id.userPhone);
//        userPwd = findViewById(R.id.userPwd);
//        userName = findViewById(R.id.userName);
////        userEmail = findViewById(R.id.userEmail);
////        rg= findViewById(R.id.rg);
//        btnRegister1 = findViewById(R.id.btnRegister1);
//        btnRegister1.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                name=userName.getText().toString();
//                phone=userPhone.getText().toString();
//                email=userEmail.getText().toString();
//                pwd=userPwd.getText().toString();
//
//                if(!name.equals("")&&!phone.equals("")&&!email.equals("")&&!pwd.equals("")){
//
//                    System.out.println("执行数据库");
//                    Toast.makeText(RegisterActivity.this,"注册成功",Toast.LENGTH_SHORT).show();
//                    RegisterActivity.this.finish();
//
//                }else {
//                    Toast.makeText(RegisterActivity.this,"请填写完整",Toast.LENGTH_SHORT).show();
//
//                }
//            }
//        });
//
//
//
//}